-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix PHP CI including PHPCS and PHPUnit; bump PHP/WP versions #1095
Conversation
5556587
to
9ffbeab
Compare
358a520
to
5c5b8dd
Compare
ce8771c
to
96a6b84
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## develop #1095 +/- ##
=============================================
+ Coverage 19.65% 29.34% +9.69%
+ Complexity 347 334 -13
=============================================
Files 57 57
Lines 2325 1690 -635
=============================================
+ Hits 457 496 +39
+ Misses 1868 1194 -674
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
}, | ||
"platform": { | ||
"php": "5.6" | ||
"php": "7.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to emulate it to 7.0
else it can download deps that don't support PHP 7.0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Humm. I had updated the composer.lock
file for PHP 8.0 so we'll need to update it for 7.0. However, when I do so then I get errors when running tests locally:
$ npm run test:php
> test:php
> wp-env run tests-cli --env-cwd=/var/www/html/wp-content/plugins/pwa/ env WORDPRESS_TABLE_PREFIX=wptests_ vendor/bin/phpunit
ℹ Starting 'env WORDPRESS_TABLE_PREFIX=wptests_ vendor/bin/phpunit' on the tests-cli container.
[18-Jan-2024 22:34:19 UTC] PHP Warning: Private methods cannot be final as they are never overridden by other classes in /var/www/html/wp-content/plugins/pwa/vendor/phpunit/phpunit/src/Util/Configuration.php on line 176
[18-Jan-2024 22:34:19 UTC] PHP Fatal error: Cannot acquire reference to $GLOBALS in /var/www/html/wp-content/plugins/pwa/vendor/phpunit/phpunit/src/Util/Configuration.php on line 543
✖ Command failed with exit code 255
If I change it to 7.4 and run composer update
then I can run PHPUnit successfully, even when I'm running PHP 8.1.
Can we change this then to (and run composer update
):
"php": "7.0" | |
"php": "7.4" |
If that means removing tests for PHP 7.0-7.3, I'm fine with that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's because the PHPUnit version is not compatible with the PHP version inside the container. So I think we need to use updated PHPUnit for local testing.
So we have two options now:
- We save PHPUnit 9.6 PHAR in bin like we do for PHPStan and keep 7.0 tests.
- Remove 7.0 tests and bump PHP emulation to 7.1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now PHPUnit version is customizable in local development with - 9fa812d
With this, we can download any PHPUnit version and keep the tests for PHP 7.0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clever!
Closes #983
Closes #1056